package freecomm.fileexplorer;

import java.io.File;
import java.util.Comparator;
/**  
 * project name  
 *   
 * FileSort.java   
 * 2012-5-7 8:52:46    
 *   
 */

/**  
 * FileSort  
 *   
 * @author: Junwei.Xu  
 */
public class FileSort
{
    static class SortBySize implements Comparator<File>{

        /* (non-Javadoc)  
         * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)  
         */
        @Override
        public int compare(File mFile1, File mFile2)
        {
            // TODO Auto-generated method stub
            long mSizeDiff = mFile1.length()-mFile2.length();
            if(mSizeDiff>0){
                return 1;
            }
            else if(mSizeDiff<0){
                return -1;
            
            }
            else{
                return 0;
            }
            
        }
        public boolean equals(File mFile){
            return true;
        }
        
    }

}
